<template>
<el-dialog class="project-del" :close-on-press-escape="false" :append-to-body="true" :title="delData.title" :visible.sync="delData.show" width="470px" :close-on-click-modal="false">
    <el-form ref="form" :model="delData">
        <el-form-item class="check-delete">您即将永久删除自己的项目，以及与您的项目相关联的所有数据。<br/>确认删除项目后，无法撤销或恢复</el-form-item>
        <el-form-item style="color:#000; margin-bottom: 8px;">请输入项目名称进行确认</el-form-item>
        <el-form-item prop="value">
            <el-input v-model="checkDel" clearable></el-input>
        </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="delData.show=false">取 消</el-button>
      <el-button type="primary" style="background:#FF0000;border-color:#FF0000" v-preventReClick="2000" @click="handleSave">删 除</el-button>
    </span>
</el-dialog>
</template>

<script>
export default {
    name: 'DelDialog',
    props: {
        delData: {
            type: Object,
            required: true
        }
    },
    data () {
        return {
            checkDel: null
        }
    },
    methods: {
        handleSave () {
            if (this.checkDel === this.delData.value) {
                this.$emit('save')
            } else {
                this.$message.error('输入错误')
            }
        }
    }
}
</script>
<style lang="less">
.project-del {
    .el-dialog__close {
        font-size: 20px;
        font-weight: bold;
        color: #515151;
    }
    .el-form {
        display: flex;
        flex-direction: column;
        .el-form-item {
            margin-bottom: 0;
        }
    }
    .el-dialog__header {
        padding-left: 24px;
    }
    .el-dialog__body {
        padding: 24px;
        height: 230px;
        .el-input {
            width: 310px !important;
        }
    }

    .check-delete {
        display: inline-block;
        color: red;
        margin-bottom: 14px !important;
        .el-form-item__content {
            line-height: 24px;
        }
        // margin: 0 5px;
    }
}
</style>
